useFixture(default)

def test():
	from Modules import commonBits
	java_recorded_version = '1.6.0_17'

	if window('Protocol Buffer Editor'):
		select('FileChooser', commonBits.sampleDir() + 'protoStoreSales3a.bin')
		click('Edit1')
##		select('JTreeTable', '')

		rightclick('JTreeTable', 'Tree,0')
		select_menu('Edit Record')
		select('Table', 'cell:Data,0(20)')
		assert_p('Table', 'Content', '[[store, 1, , 20, 20], [name, 2, , Store: 20, Store: 20]]')
		
		select('Table', '2011', 'Data,0')
		select('Table', 'Store: 2011', 'Data,1')
		select('Table', 'cell:Data,0(2011)')
		assert_p('Table', 'Content', '[[store, 1, , 2011, 2011], [name, 2, , Store: 2011, Store: 2011]]')
		click('Down')
		select('Table', 'cell:Data,1(Department: 170)')
		assert_p('Table', 'Content', '[[department, 1, , 170, 170], [name, 2, , Department: 170, Department: 170]]')
		select('Table', 'Department: 17011', 'Data,1')
		select('Table', '17011', 'Data,0')
		select('Table', 'cell:Data,1(Department: 17011)')
		assert_p('Table', 'Content', '[[department, 1, , 17011, 17011], [name, 2, , Department: 17011, Department: 17011]]')
		select('Table', 'cell:Data,0(17011)')
		assert_p('Table', 'Content', '[[department, 1, , 17011, 17011], [name, 2, , Department: 17011, Department: 17011]]')
		click('Down')
		select('Table', 'cell:Data,1(40118)')
		assert_p('Table', 'Content', '[[keycode, 1, , 63604808, 63604808], [saleDate, 2, , 40118, 40118], [quantity, 3, , 1, 1], [price, 4, , 4870, 4870]]')
		select('Table', '111', 'Data,2')
		select('Table', '487011', 'Data,3')
		select('Table', 'cell:Data,1(40118)')
		assert_p('Table', 'Content', '[[keycode, 1, , 63604808, 63604808], [saleDate, 2, , 40118, 40118], [quantity, 3, , 111, 111], [price, 4, , 487011, 487011]]')
		click('Save1')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('Open')
		click('Edit1')
##		select('JTreeTable', '')
		rightclick('JTreeTable', 'Tree,0')
		select_menu('Edit Record')
		select('Table', 'cell:Data,0(2011)')
		assert_p('Table', 'Content', '[[store, 1, , 2011, 2011], [name, 2, , Store: 2011, Store: 2011]]')
		select('Table', '20', 'Data,0')
		select('Table', 'Store: 20', 'Data,1')
		select('Table', 'cell:Data,0(20)')
		assert_p('Table', 'Content', '[[store, 1, , 20, 20], [name, 2, , Store: 20, Store: 20]]')
		click('Down')
		select('Table', '170', 'Data,0')
		select('Table', 'cell:Data,1(Department: 17011)')
		assert_p('Table', 'Content', '[[department, 1, , 170, 170], [name, 2, , Department: 17011, Department: 17011]]')
		select('Table', 'cell:Data,1(Department: 17011)')
		select('Table', 'Department: 170', 'Data,1')
		select('Table', 'cell:Data,0(170)')
		assert_p('Table', 'Content', '[[department, 1, , 170, 170], [name, 2, , Department: 170, Department: 170]]')
		click('Down')
		select('Table', 'cell:Data,1(40118)')
		assert_p('Table', 'Content', '[[keycode, 1, , 63604808, 63604808], [saleDate, 2, , 40118, 40118], [quantity, 3, , 111, 111], [price, 4, , 487011, 487011]]')
		select('Table', '1', 'Data,2')
		select('Table', '4870', 'Data,3')
		select('Table', 'cell:Data,2(1)')
		select('Table', 'cell:Data,1(40118)')
		assert_p('Table', 'Content', '[[keycode, 1, , 63604808, 63604808], [saleDate, 2, , 40118, 40118], [quantity, 3, , 1, 1], [price, 4, , 4870, 4870]]')
		click('Save1')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('Edit1')
##		select('JTreeTable', '')
		rightclick('JTreeTable', 'Tree,0')
		select('JTreeTable', 'cell:Tree,0(null)')
		assert_p('JTreeTable', 'Content', '[[, , 20, Store: 20], [, , 59, Store: 59], [, , 166, Store: 166], [, , 184, Store: 184]]')
		select('JTreeTable', 'cell:Tree,0(null)')
		rightclick('JTreeTable', 'Tree,0')
		select_menu('Edit Record')
		select('JTreeTable', 'cell:Tree,0(null)')
		select('Table', 'cell:Data,0(20)')
		assert_p('Table', 'Content', '[[store, 1, , 20, 20], [name, 2, , Store: 20, Store: 20]]')
		click('Down')
		select('Table', 'cell:Data,0(170)')
		assert_p('Table', 'Content', '[[department, 1, , 170, 170], [name, 2, , Department: 170, Department: 170]]')
		click('Down')
		select('Table', 'cell:Data,1(40118)')
		assert_p('Table', 'Content', '[[keycode, 1, , 63604808, 63604808], [saleDate, 2, , 40118, 40118], [quantity, 3, , 1, 1], [price, 4, , 4870, 4870]]')
		click('Right')
		select('Table', 'cell:Data,1(4870)')
		select('Table', 'cell:Data,1(4870)')
		assert_p('Table', 'Content', '[[quantity, 1, , 1, 1], [price, 2, , 4870, 4870], [count, 3, , 1, 1]]')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')

#		if window('Save Changes to file: ' + commonBits.sampleDir() + 'protoStoreSales3a.bin'):
#			click('No')
#		close()
	close()
